#ifndef SESSIONEXTRACTOR_H
#define SESSIONEXTRACTOR_H

#include "request.h"
#include "session.h"
#include <QList>

class SessionExtractor
{
public:
    SessionExtractor();
    void setRequests(QList<Request*> *requests);
    void findAllHosts();
    void findAllSessions();
    void findMostPopularPages();
    void compressSessions(int support);

    void saveSessionsAsArff(QString filename);
    void saveUsersAsArff(QString filename);

    void setSessionTime(int sessionTime);
    static bool sortLessThan(const QPair<QString, int> *p1, const QPair<QString, int> *p2);

    // For debug purpose only!
    QList<Session*> *getSessions();
    QList<QPair<QString,int> *> *getMostPopularPages();

    void debug();

private:
    QList<Request*> *requests;
    QList<QString> *uniqueHosts;
    QList<Session*> *sessions;
    QList<QPair<QString,int> *> *mostPopularPages;

    bool oneHostOneUser;


    int sessionTime;
};

#endif // SESSIONEXTRACTOR_H
